vcMotionTarget
vcMotionTarget is a motion target for a robot, which may include joint and tool behavior as well as speed and configuration settings for orientation solutions.
See in: Overview
Module: vcRobotics
Parent: vcObject
Children -
Referenced by: vcMotionInterpolator.Targets, vcMotionInterpolator.createTarget(), vcMotionInterpolator.interpolate(), vcRobotController.createTarget()
Properties
Learn how to use properties here. The properties are also inherited from the parent class.
| Name | Type | Access | Description |
| AccuracyMethod | vcMotionAccuracyMethod | RW | Defines the zone of accuracy type to use for the target, for example distance, time or velocity. |
| AccuracyValue | Real | RW | Defines the limit used in AccuracyMethod. |
| AngularSpeed | Real | RW | Defines the rate of target rotation (degrees/s), which is only used for non-joint motions. |
| BaseMatrix | vcMatrix | RW | Defines a matrix referenced by the target as robot base frame. If set, this property overrides BaseName. |
| BaseName | String | RW | Defines base frame in robot controller referenced by the target. |
| CartesianAcceleration | Real | RW | Defines the maximum Cartesian acceleration (units/s^2) of linear motion to target. |
| CartesianDeceleration | Real | RW | Defines the maximum Cartesian deceleration (units/s^2) of linear motion to target. |
| CartesianSpeed | Real | RW | Defines the maximum Cartesian speed (units/s) of linear motion to target. |
| ConfigCount | Integer | R | Gets the number of available configurations in robot. |
| ConfigurationMode | vcMotionConfigurationMode | RW | Defines the robot's joint configuration during linear interpolation,See morewhich can be fixed, an attempt to maintain current configuration or one interpolated using joint values. |
| JointSpeedFactor | Real | RW | Defines the joint speed at the target, as a factor of maximum speed determined in robot controller. |
| JointTurnMode | vcMotionTargetTurn | RW | Defines the turn mode for joints in the target. The default mode is for joints to turn nearest within their set limits. |
| JointValues | list[Real] | RW | Defines joints values of target if using joint interpolation.See moreTo read and write joint values, first get a handle for this property, edit the values of that handle, and then assign that handle as the value of this property. |
| MotionType | vcMotionType | RW | Defines the motion type of the target, which is either linear or point-to-point/joint. |
| OrientationInterpolationMode | vcMatrixMode | RW | Defines the orientation interpolation mode for linear movement. |
| PositionerIndex | Integer | RW | Defines current positioner used by robot to reach target. |
| RobotConfig | Integer | RW | Defines robot configuration at target, which is dependent on the kinematic structure. |
| Target | vcMatrix | RW | Defines position matrix of target relative to its base frame or matrix. |
| TargetMode | vcMotionTargetMode | RW | Defines how position matrix of target relates to robot. |
| ToolMatrix | vcMatrix | RW | Defines a matrix referenced by the target as the robot tool frame. If set, this property overrides ToolName. |
| ToolName | String | RW | Defines tool frame in robot referenced by target. |
| UseJoints | Boolean | RW | Defines if JointValues property is used to define target or its Target property.See moreThat is, whether the target is defined using joint values or a position matrix that is used to calculate joint values. If you set JointValues, this property is automaticaly set to True. If you set Target, this property is automatically set to False. |
Methods
Learn how to use methods here. The methods are also inherited from the parent class.
| Name | Return Type | Parameters | Description |
| getConfigWarning | Integer | Integer configuration | Tests a robot configuration for any potential issues associated with target.See moreThe returned value indicates singularity (S), joint limits (J) and unreachable (U) errors using a format of SJU. 0 = 000 No errors. 1 = 001 Reachability error in robot. 2 = 010 One or more joints exceeding limits. 3 = 011 Reachability and joint limit errors. 4 = 100 Singularity detected, for example in articulated robot wrist. 5 = 101 Singularity and reachability errors. 6 = 110 Singularity and joint limit errors. 7 = 111 Singularity, joint limit and reachability errors. See Motion Target Constants for more information. Parameters: configuration (Integar): Robot configuration Returns: Enumeration (vcMotionConfigurationStatus) |
| getConfigWarnings | list[Integer] | None | Tests all configurations in kinematic structure for potentials errors related to target.See moreSee getConfigWarning() method for more information on possible returned values. Returns: List of Enumeration (vcMotionConfigurationStatus) |
| getPositionerRootToPositionerFlange | vcMatrix | None | Returns the offset from robot positioner root node to its flange node. Returns: Matrix (vcMatrix) |
| getRobotRootToRobotFlange | vcMatrix | None | Returns the offset from robot root node to robot flange node. Returns: Matrix (vcMatrix) |
| getRootNodeToPositionerRoot | vcMatrix | None | Returns the offset from root node to robot positioner root node. Returns: Matrix (vcMatrix) |
| getRootNodeToRobotRoot | vcMatrix | None | Returns the offset from root node to robot root node. Returns: Matrix (vcMatrix) |
| getSimWorldToRobotTool | vcMatrix | None | Returns the offset from 3D world origin to tool frame active in robot. Returns: Matrix (vcMatrix) |
| getSimWorldToRobotWorld | vcMatrix | None | Returns the offset from 3D world origin to Robot World Frame. Returns: Matrix (vcMatrix) |
| getSimWorldToRootNode | vcMatrix | None | Returns the offset from 3D world origin to root node. Returns: Matrix (vcMatrix) |
Example: Calculate Inverse Kinematics
"""Calculate inverse kinematics for given target matrix""" import vcCore as vc import vcBehaviors as vc_beh import vcRobotics as vc_robo app = vc.getApplication() comp = vc.getComponent() async def OnRun(): ctr = comp.findBehavior(vc_beh.vcBehaviorType.ROBOT_CONTROLLER) base_name = ctr.Bases[0].Name tool_name = ctr.Tools[0].Name config = 0 init_joints = [x.CurrentValue for x in ctr.Joints] target_matrix = vc.vcMatrix.new() target_matrix.P = vc.vcVector.new(800.0, 0.0, 500.0) target_matrix.WPR = vc.vcVector.new(0.0, 180.0, 0.0) # Solve joint values for given target joint_values = calc_inverse(ctr, target_matrix, base_name, tool_name, config, init_joints) print('Joint values: ', joint_values) # Move robot to solved joint values for i, j in enumerate(ctr.Joints): j.CurrentValue = joint_values[i] app.render() def calc_inverse(controller, target_matrix, base_name, tool_name, config, init_joints): """Caclulate inverse kinematics using motion target""" # Create target motion_target = controller.createTarget() # Set base and tool motion_target.BaseName = base_name motion_target.ToolName = tool_name # Set initital joints, used to define joint turns and external axes motion_target.JointValues = init_joints # Set robot config motion_target.RobotConfig = config # Set target matrix motion_target.Target = target_matrix # Return joint values return motion_target.JointValues
Example: Robot Pose to Target
from vcCore import * from vcFeatures import * from vcGeometry import * from vcBehaviors import * from vcRobotics2 import * def robot_pose_to_target(controller: vcMotionController, type: vcMotionTargetType, toolName="Null", baseName="Null") -> vcLinearTarget | vcPtpTarget | vcMultiDriverTarget: """Compile robot target from curen robot position, based on motion target type, tool and base data. (Excludes speed data)""" # Controller driver positions internalDriverPositions = controller.DriverPositions externalDriverPositions = controller.ExternalDriverPositions # Joint target does not require solving if type == vcMotionTargetType.MULTIDRIVER: target: vcMultiDriverTarget = controller.createTarget(type) target.InternalDriverValues = [(i, val) for i, val in enumerate(internalDriverPositions)] target.ExternalDriverValues = externalDriverPositions return target # Cartesian targets require use of kinematic solver if type == vcMotionTargetType.LINEAR or vcMotionTargetType.PTP: # Kinematics object for controller kinematics = controller.Kinematics # Create solver for calculating forward kinematic solution for pose solver = kinematics.createSolver() # Define all forvard solution related information solver.RootMatrix = controller.Component.WorldPositionMatrix solver.BaseMatrix = kinematics.findBase(baseName).PositionMatrix solver.ToolMatrix = kinematics.findTool(toolName).PositionMatrix # Fill in preoperties based on target type target: vcLinearTarget | vcPtpTarget = controller.createTarget(type) target.Target = solver.forward(internalDriverPositions) if isinstance(target, vcLinearTarget): target.InternalDriverValues = internalDriverPositions if isinstance(target, vcPtpTarget): target.DriverReferenceValues = internalDriverPositions target.ExternalDriverValues = externalDriverPositions return target # Snippet ------------------------------------ def OnReset(): controller: vcMotionController = getComponent().findBehaviorsByType(vcBehaviorType.ROBOTICS2_MOTIONCONTROLLER)[0] target = robotPoseToTarget(controller, vcMotionTargetType.LINEAR, "TOOL[1]", "BASE_2")